package test0ne.设计模式.备忘录;

public class Doc {
    private String name;
    private String body;

    public Doc(String name) {
        this.name = name;
        this.body = "";
    }

    public void setBody(String body) {
        this.body = body;
    }

    public String getName() {
        return this.name;
    }

    public String getBody() {
        return this.body;
    }

    public History createHistory() {
        return new History(body);
    }

    public void restoreHistory(History history) {
        this.body = history.getBody();
    }
}
